<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>菜品管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

    /* tooltip */
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
</style>
</head>
<body style="padding:10px;">
	<div style="float: right;margin-right:5%;"><button onclick="add_caipin()" class="layui-btn layui-btn-normal layui-btn-sm">+新增菜品</button></div>
  <div class="tplay-body-div"> 
  <div class="layui-tab">
    <ul class="layui-tab-title">
      <li class="layui-this">菜品管理</li>
      <li><a href="{:url('admin/dinner/caipin_type')}" class="a_menu">菜品分类</a></li>
    </ul>
  </div>
      	<form class="layui-form serch" action="" method="post">
				<div class="layui-form-item" style="float: left;">
					<div class="layui-input-inline">
						<div class="layui-inline">
							<select name="store_name_id" lay-search="">
								<option value="">门店</option>
								{volist name="$stores" id="vo"}
								<option value="{$vo.id}">{$vo.store_name}</option>
								{/volist}
							</select>
						</div>
					</div>
					
					<button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="serch">查询</button>
				</div>
			</form>
  <table class="layui-table" lay-size="sm">
  	
    <colgroup>
      <col width="100">
      <col width="200">
      <col width="200">
      <col width="200">
      <col width="200">
      <col width="200">
      <col width="100">
      <col width="200">
    </colgroup>
    <thead>
      <tr>
        <th>菜品名称</th> 
        <th>所属分店</th>
        <th>菜品分类</th>
        <th>售价</th>
        <th>库存</th>
        <th>状态</th>
        <th>操作</th>
      </tr> 
    </thead>
    <tbody>
      {volist name="list" id="vo"}
      <tr> 
        <td>{$vo.name}</td>   
        <td>{$vo.store_id}</td>
        <td>{$vo.type_id}</td>
        <td>{$vo.price}</td>
        <td>{$vo.store}</td>
        <td>{$vo.status}</td>
        <td class="operation-menu">
          <div class="layui-btn-group">
            <a href="javascript:edit_caipin({$vo.id})" class="layui-btn layui-btn-xs a_menu layui-btn-primary" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
          </div>
        </td>
      </tr>
      {/volist}
    </tbody>
  </table>
          
  {include file="public/foot"}
  <script type="text/javascript">

  
  </script>

  <script>
  	function edit_caipin(id){
					var url="/admin/dinner/add_caipin?id="+id;
					layer.open({
							type: 2,
							title: '编辑菜品',
							shadeClose: true,
							shade: 0.8,
							area: ['960px', '720px'],
							content: [url]
						});
		}
  	function add_caipin(){
  		layer.open({
				type: 2,
				title: '新增菜品',
				shadeClose: true,
				shade: 0.8,
				area: ['960px', '720px'],
				content: ["{:url('admin/dinner/add_caipin')}"]
			});
  	}
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $(window).on('load', function() {
            form.on('submit(admin)', function(data) {
                $.ajax({
                    url:"{:url('admin/store/publishemp')}",
                    data:$('#admin').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            layer.alert(res.msg, function(index){
                              location.href = res.url;
                            })
                        } else {
                            layer.msg(res.msg);
                        }
                    }
                })
                return false;
            });
        });
    });
  </script>
</div>
</body>
</html>
